<%--
  Created by IntelliJ IDEA.
  User: wangj
  Date: 2020/4/19
  Time: 19:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加</title>
</head>
<body>

    <div style="margin-left: 30%;margin-top: 5%">
        <form>
            <table>
                <tr>
                    <td>姓名</td>
                    <td>
                        <input type="text" id="name" name="name"/>
                    </td>
                </tr>
                <tr>
                    <td>地址</td>
                    <td>
                        <input type="text" id="address" name="address"/>
                    </td>
                </tr>
                <tr>
                    <td>电话</td>
                    <td>
                        <input type="text" id="phone" name="phone"/>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="right">
                        <input type="button" value="提交" id="addResume">
                    </td>
                </tr>

            </table>
        </form>
    </div>

<script src="/js/jquery-1.9.1.min.js" type="application/javascript"></script>
<script>
    $(function(){
        addResume.init();
    });

    let addResume = {
        init:function() {
            $('#addResume').click(function(){
               $.ajax({
                  url:'/resume/add',
                  type:'post',
                  dataType:'json',
                  data:{'name':$('#name').val(), 'address':$('#address').val(), 'phone':$('#phone').val()},
                  success:function(data) {
                        if (data.errCode == 200) {
                            window.location = '/resume/';
                        } else {
                            alert('添加失败');
                        }
                  },
               });
            });
        },
    };
</script>
</body>
</html>
